<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>建安产值汇总表</title>
  <style type="text/css">
  </style>
</head>
<body>
  <div class="layui-fluid">   
    <div class="layui-card">
      <!-- 查询区域  -->
      <div id="query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            	<label class="layui-form-label">统计月份</label>
            	<div class="layui-input-inline">
              		<input type="text" class="layui-input" id="sts_month"  name="stsMonth" readonly placeholder="统计月份">
            	</div>
          </div>
          <div class="layui-inline">
            	<label class="layui-form-label">公司主体</label>
            	<div class="layui-input-inline" style="width:260px;">
              		<select name="orgTypeAndId" id="query_select_orgId" lay-filter="query_select_orgId" lay-search >
	              		<c:if test="${not empty orgInfos }">
	              			<c:forEach items="${orgInfos}" var="org">
	              				<option value="${org.id}-${org.types}" <c:if test="${org.id == bindOrgId }">selected</c:if>>${org.compName }</option>
		            		</c:forEach>
	              		</c:if>
	              	</select>
            	</div>
          	</div>
          	<div class="layui-inline">
            	<label class="layui-form-label">项目名称</label>
            	<div class="layui-input-inline">
              		<input type="text" name="orgProName" id="query_input_orgProName"  placeholder="请输入" autocomplete="off" class="layui-input" >
            	</div>
          	</div>
          	<shiro:hasPermission name="LIST_CAE_COLLECT">
	          <div class="layui-inline">
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-caeCollect-search">
	              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
	            </button>
	          </div>
          	</shiro:hasPermission>
        </div>
      </div>
      <div class="layui-card-body">
        <table id="LAY-caeCollect-manage" lay-filter="LAY-caeCollect-manage"></table>
      </div>
    </div>
  </div>

  <script>
  var stageJSON = <infopub:dicJson groupNo="A00010077" />;
  	layui.config({
    	base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  	}).extend({
    	index: 'lib/index' //主入口模块
  	}).use(['index', 'table', 'set', 'laydate', 'element'], function(){
    	var $ = layui.$
    	,form = layui.form
    	,table = layui.table
    	,laydate = layui.laydate
    	,element = layui.element;
    	
	    laydate.render({
		      elem: '#sts_month'
		      ,type: 'month'
		      ,btns: ['now', 'confirm']
		      ,format:'yyyy年MM月'
		      ,value: layui.util.toDateString(new Date().getTime() - 2592000000 , 'yyyy年MM月') //30天前
		      ,done:function(value, date){
		      table.reload('LAY-caeCollect-manage', {page: {curr: 1},
				 	 where: {'stsMonth':value,'orgTypeAndId':$('#query_select_orgId').val(),'proName':$('#query_input_orgProName').val()}
			      });			      
	    	  }
	    });
	    
		form.on('select(query_select_orgId)', function(data){
   		 	table.reload('LAY-caeCollect-manage', {page: {curr: 1},
		 		where: {'stsMonth':$('#sts_month').val(),'orgTypeAndId':$('#query_select_orgId').val(),'orgProName':$('#query_input_orgProName').val()}
	      	});
    	});
		
    	// 表单
    	table.render({
      		elem: '#LAY-caeCollect-manage'
      		,url: basePath + '/caeCollect/queryDataByCondition' //请求数据接口
      		,cols: [[
						{type:'numbers', title: '序号',fixed:'left', width: 80, align:'center', rowspan: 2}
						,{field: 'proName', title: '项目名称',fixed:'left',width: 180, align:'center', rowspan: 2}
						,{field: 'hrOrgAreaName', title: '区域公司',fixed:'left',width: 180, align:'center', rowspan: 2}
						,{field: 'cotCaeAmount', title: '合同建安费（元）',width: 150, align:'center', rowspan: 2, templet: function(d){
							    return formatCurrency(d.cotCaeAmount);
						}}
						,{title: '当前产值-下浮前', align:'center', colspan: 2}						
						,{title: '当前产值-下浮后', align:'center', colspan: 2}
						,{field: 'monthCaeGross', title: '当月建安毛利（元）',width: 170, align:'center', rowspan: 2, templet: function(d){
						    return formatCurrency(d.monthCaeGross);
						}}
						,{title: '开累产值-下浮前', align:'center', colspan: 2}
						,{title: '开累产值-下浮后', align:'center', colspan: 2}
						,{field: 'addupCaeGross', title: '开累建安毛利（元）',width: 170, align:'center', rowspan: 2, templet: function(d){
						    return formatCurrency(d.addupCaeGross);
						}}
						,{field: 'addupFinishRate', title: '开累完工比（产值）（%）',width: 210, align:'center', rowspan: 2}
						],[
							{field: 'monthInPre', title: '对内（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.monthInPre);
							}}
							,{field: 'monthOutPre', title: '对外（元）',width: 150, align:'center', templet: function(d){
								return formatCurrency(d.monthOutPre);
							}}   
							,{field: 'monthInAfter', title: '对内（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.monthInAfter);
							}}
							,{field: 'monthOutAfter', title: '对外（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.monthOutAfter);
							}} 
							,{field: 'addupInPre', title: '对内（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.addupInPre);
							}}
							,{field: 'addupOutPre', title: '对外（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.addupOutPre);
							}}
							,{field: 'addupInAfter', title: '对内（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.addupInAfter);
							}}
							,{field: 'addupOutAfter', title: '对外（元）',width: 150, align:'center', templet: function(d){
							    return formatCurrency(d.addupOutAfter);
							}}
						]]						
	      		,page: false
	      		,limit: 10
	      		,where: {'stsMonth':$('#sts_month').val(),'orgTypeAndId':$('#query_select_orgId').val(),'orgProName':$('#query_input_orgProName').val()}
	    	});
    
    	<shiro:hasPermission name="LIST_CAE_COLLECT">
	    	//监听搜索
	    	form.on('submit(LAY-caeCollect-search)', function(data){
		      	//执行重载
		      	table.reload('LAY-caeCollect-manage', {page: {curr: 1},
		        	where: trimData(data)
		      	});
	    	});
    	</shiro:hasPermission>
  });  	
  </script>
</body>
</html>

